/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.fixedexpense;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.modules.base.entity.supplier.Supplier;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 固定费用项目Entity
 * @author Kilo
 * @version 2021-03-02
 */
@Table(name="t_supplier_price", alias="a", columns={
		@Column(name="supplier_price_id", attrName="supplierPriceId", label="供应商销售价格ID", isPK=true),
		@Column(name="supplier_id", attrName="supplierId", label="供应商"),
		@Column(name="price", attrName="price", label="采购价格"),
		@Column(name="ratio", attrName="ratio", label="费用比例"),
		@Column(name="fixed_expense_id", attrName="fixedExpenseId.fixedExpenseId", label="固定费用项目ID"),
	}, joinTable={
		@JoinTable(type=Type.LEFT_JOIN, entity= Supplier.class, attrName="supplier", alias="u11",
				on="u11.supplier_id = a.supplier_id", columns={
				@Column(name="supplier_id", label="供应商编码", isPK=true),
				@Column(name="supplier_name", label="供应商名称", isQuery=false),
		}),
	},orderBy="a.supplier_price_id ASC"
)
public class SupplierPrice extends DataEntity<SupplierPrice> {
	
	private static final long serialVersionUID = 1L;
	private String supplierPriceId;		// 供应商销售价格ID
	private String supplierId;		// 供应商
	private Double price;		// 采购价格
	private String ratio;		// 费用比例
	private FixedExpense fixedExpenseId;		// 固定费用项目ID 父类
	private Supplier supplier;

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public SupplierPrice() {
		this(null);
	}


	public SupplierPrice(FixedExpense fixedExpenseId){
		this.fixedExpenseId = fixedExpenseId;
	}
	
	public String getSupplierPriceId() {
		return supplierPriceId;
	}

	public void setSupplierPriceId(String supplierPriceId) {
		this.supplierPriceId = supplierPriceId;
	}
	
	@NotBlank(message="供应商不能为空")
	@Length(min=0, max=64, message="供应商长度不能超过 64 个字符")
	public String getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(String supplierId) {
		this.supplierId = supplierId;
	}
	
	@NotNull(message="采购价格不能为空")
	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}
	
	@Length(min=0, max=10, message="费用比例长度不能超过 10 个字符")
	public String getRatio() {
		return ratio;
	}

	public void setRatio(String ratio) {
		this.ratio = ratio;
	}
	
	public FixedExpense getFixedExpenseId() {
		return fixedExpenseId;
	}

	public void setFixedExpenseId(FixedExpense fixedExpenseId) {
		this.fixedExpenseId = fixedExpenseId;
	}
	
}